'''
下载包
    pip install splinter -i https://pypi.douban.com/simple/
'''

from splinter import Browser
from time import sleep

browser = Browser('chrome') # 创建浏览器实例
browser.visit('https://www.baidu.com')  # 访问baidu
# 将关键词填入搜索框 通过wd这个名字找到对应的Elements
browser.fill('wd', 'splinter - python acceptance testing for web applications')
browser.find_by_id('su').click()  # 通过id找到点击按钮，并点击
if browser.is_text_present('splinter.readthedocs.io'):  # 对响应结果进行处理
    print("Yes, the official website was found!")
else:
    print("No, it wasn't found... We need to improve our SEO techniques")
sleep(10)
browser.quit()